home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 August / August CD.bin / Shareware / Programming / Help on Wheels ƒ / HoW Developer’s Kit 1.1 / HoWSample / HoWSample Help / HoWSample Help.rsrc / STR#_1029.txt < prev    next >
Encoding:
Text File  |  1994-06-05  |  9.0 KB  |  363 lines

  1. 
  2.  
  3. 
  4.  
  5. pascal OSErr HoWOpen (const FSSpec *helpFile);
  6.  
  7. */
  8.  
  9. when calculating the system heap requirement for your 'sysz' resource.
  10.  
  11. extensions, because it uses the Notification Manager; allow 5000 bytes
  12.  
  13. always used.  This may be called by 'INIT' logic in control panels or
  14.  
  15. checking is not performed, and the current script's current language is
  16.  
  17. opened (as for a background-only application calling HoWDisplay).  Version
  18.  
  19. the server is absent, a TeachText copy is created on the desktop and
  20.  
  21. applications; applications should use HoWRegister instead (see above).  If
  22.  
  23. help file.  This method is suggested for use by programs which are not
  24.  
  25. /* Launch the help server, if necessary, to open and display the given
  26.  
  27. 
  28.  
  29. 
  30.  
  31. 
  32.  
  33. pascal OSErr HoWDeregister (void);
  34.  
  35. before it exits, the server will deregister it automatically. */
  36.  
  37. /* Deregister with the help server.  If the client fails to deregister
  38.  
  39. 
  40.  
  41. 
  42.  
  43. 
  44.  
  45. pascal OSErr HoWDisplay (short tag, Boolean casual);
  46.  
  47. to the foreground unless they are hidden before this call. */
  48.  
  49. foreground.  Note that modal dialogs will prevent the server from coming
  50.  
  51. in the foreground; a non-casual display always brings the server to the
  52.  
  53. displaying this client's help file.  A casual display always leaves the client
  54.  
  55. running in the background, with the "follow" option in effect, and already
  56.  
  57. desktop.  A casual display is effective only if the server is started and
  58.  
  59. in which case no alerts appear, and the document is created on the
  60.  
  61. TeachText and open it for viewing, unless the client is background-only,
  62.  
  63. absent, the user sees an alert offering to save a readable copy using
  64.  
  65. "casual" is false, this will attempt to start the server; if the server is
  66.  
  67. last seen position is retained.  If the server is not already started, and
  68.  
  69. /* Display the help file at the indicated tag position.  If "tag" is zero, the
  70.  
  71. 
  72.  
  73. 
  74.  
  75. 
  76.  
  77.                           HoWHandlerProcPtr handler);
  78.  
  79.                           LangCode defaultLanguage, Boolean startServer,
  80.  
  81. pascal OSErr HoWRegister (const FSSpec *helpFile, short version,
  82.  
  83. client does not support them. */
  84.  
  85. noAppleEventsErr.  The Help event handler is optional; pass nil if the
  86.  
  87. codes listed above; the expected error code under System 6 is
  88.  
  89. starts by some other method.  Gestalt checks may result in other error
  90.  
  91. deferred until the first non-casual display (see below) or until the server
  92.  
  93. return code is noErr, meaning that the actual registration has been
  94.  
  95. "startServer" is false (which it should be for most clients), the usual
  96.  
  97. HoWDisplay below).  If the server is not already started, and
  98.  
  99. noServerApplErr, a non-fatal code returned for your information (see
  100.  
  101. server, which may result in many OS error codes, as well as
  102.  
  103. started, and "startServer" is true, HoWRegister will try to start the
  104.  
  105. client can switch to another help file.  If the server is not already
  106.  
  107. to use its own language over "defaultLanguage".  By re-registering, the
  108.  
  109. nor for langEnglish, noMasterResErr is returned.  The server will prefer
  110.  
  111. file for the current script's current language, nor for "defaultLanguage",
  112.  
  113. wrongVersionErr is returned.  If there is no master resource in the help
  114.  
  115. resource, and the version (first word) does not match "version",
  116.  
  117. file, including the main application file.  If the help file has a 'vers'(1)
  118.  
  119. /* Register or re-register with the help server.  The help file may be any
  120.  
  121. 
  122.  
  123. 
  124.  
  125. 
  126.  
  127.                               short aliasResID, FSSpecPtr helpFile);
  128.  
  129.                               short applicationFileRefNum,
  130.  
  131. pascal OSErr HoWFindHelpFile (short preferencesFileRefNum,
  132.  
  133. the preferences file. */
  134.  
  135. same value, and the application file will be treated as though it were also
  136.  
  137. maintain a separate preferences file, set both resource file IDs to the
  138.  
  139. until a later fast search successfully finds the help file.  If you do not
  140.  
  141. is not repeated; this note remains until the preferences file is deleted, or
  142.  
  143. file.  A failed exhaustive search is noted in the preferences file so that it
  144.  
  145. one exhaustive search will be done on the alias record in the application
  146.  
  147. alias resource if present.  If the help file cannot be found by a fast search,
  148.  
  149. application file, so it can take advantage of relative information in the
  150.  
  151. possible.  The application file is not changed.  Resolution is relative to the
  152.  
  153. changed by UpdateAlias, is written back to the preferences file if
  154.  
  155. preferences file or cannot be resolved.  The alias record, possibly
  156.  
  157. file with ID "applicationFileRefNum" if the resource does not exist in the
  158.  
  159. in the resource file with ID "preferencesFileRefNum", or in the resource
  160.  
  161. /* Find the help file referenced by the 'alis' resource with ID "aliasResID"
  162.  
  163. 
  164.  
  165. 
  166.  
  167. 
  168.  
  169. typedef pascal void (*HoWHandlerProcPtr) (short id);
  170.  
  171. the tag associated with the clicked text. */
  172.  
  173. /* The Help event handler receives an event id which is the negative of
  174.  
  175. 
  176.  
  177. 
  178.  
  179. 
  180.  
  181. descriptions.
  182.  
  183. follow along in the HoWSample source code as you read these function
  184.  
  185. and when to call them, quoting from the C header file.  You may want to
  186.  
  187. This subsection describes exactly what the HoWLib functions do, and how
  188.  
  189. 
  190.  
  191. xHoWLib Client Interface Library Functions
  192.  
  193. 
  194.  
  195. 
  196.  
  197. 
  198.  
  199. server‚Äôs Preferences dialog.
  200.  
  201. ineffective if the user has not selected the ‚Äúfollow‚Äù option in the
  202.  
  203. is not already displaying the client‚Äôs help file.  Fourth, they are
  204.  
  205. the server into the foreground.  Third, they are ineffective if the server
  206.  
  207. they do not start the server if it isn‚Äôt running.  Second, they do not bring
  208.  
  209. Specifically, casual displays are different in the following ways:  First,
  210.  
  211. 
  212.  
  213. effectively taking control of the help display.
  214.  
  215. mechanism allows the client to use the server‚Äôs optional ‚Äúfollow‚Äù mode,
  216.  
  217. makes the call more of a hint to the server, and less of an order.  This
  218.  
  219. selects a menu item or clicks on a dialog item.  Setting ‚Äúcasual‚Äù to true
  220.  
  221. user action.  HoWSample requests a casual display whenever the user
  222.  
  223. function is always false when HoWSample calls it in reaction to a direct
  224.  
  225. help using casual displays.  The ‚Äúcasual‚Äù argument to the HoWDisplay
  226.  
  227. HoWSample also demonstrates how you can implement context-sensitive
  228.  
  229. 
  230.  
  231. 
  232.  
  233. tag values, demonstrating how a client can index the help file.
  234.  
  235. Subsidiary items in the Help menu cause calls to HoWDisplay with other
  236.  
  237. dialog is open, some tag value appropriate to the cursor location.
  238.  
  239. presses the Help key, it calls HoWDisplay with ‚Äútag‚Äù set to 0, or if a
  240.  
  241. client practices.  Whenever the user selects the main Help menu item or
  242.  
  243. HoWSample is a very simple client application which demonstrates good
  244.  
  245. 
  246.  
  247. xCasual Displays
  248.  
  249. 
  250.  
  251. 
  252.  
  253. 
  254.  
  255. puts them in a new directory.
  256.  
  257. large for TeachText to open, the engine breaks it into several files and
  258.  
  259. engine creates the file and opens it automatically.  If the file would be too
  260.  
  261. to save the help text as a TeachText document.  If the user agrees, the
  262.  
  263. can‚Äôt be found on any mounted volume, the engine posts an alert, offering
  264.  
  265. If you call HoWDisplay when the server is not started, and the server
  266.  
  267. 
  268.  
  269. invoking your handler, if you have one.
  270.  
  271. application to its Help menu.  The engine also takes care of Help events by
  272.  
  273. running, the engine senses this, and makes sure that the server adds your
  274.  
  275. If the server is started by some other method while your application is
  276.  
  277. purgeable code segment named ‚ÄúHoWLib,‚Äù manages these details for you.
  278.  
  279. while your application is running.  The client engine, contained in a
  280.  
  281. whether it‚Äôs running already, or what to do if the user exits the server
  282.  
  283. server.  Your application doesn‚Äôt have to care where the server is, or
  284.  
  285. The client engine handles the rest of the relationship between client and
  286.  
  287. 
  288.  
  289. latter, less obnoxious, option.
  290.  
  291. availability is critical to your application, you will usually choose the
  292.  
  293. immediately, or deferring until the first display.  Unless the server‚Äôs
  294.  
  295. When you register, you have the option of starting the server
  296.  
  297. 
  298.  
  299. for display nor for Help events.
  300.  
  301. necessary).  It cannot communicate with the server using tags, neither
  302.  
  303. call HoWOpen to tell the server to open the help file (starting the server if
  304.  
  305. It can call HoWFindHelpFile to find its help file if it is separate, and it can
  306.  
  307. If your program is not an application, it cannot use client engine functions.
  308.  
  309. 
  310.  
  311. 
  312.  
  313. the rules.)
  314.  
  315. (Click this hot button to hear what famous Apple product doesn‚Äôt play by
  316.  
  317. event, which is generally good practice.
  318.  
  319. when you receive any high-level event that isn‚Äôt known not to be an Apple
  320.  
  321. Apart from that, the only requirement is to call AEProcessAppleEvent
  322.  
  323. in response to menu, mouse, and key events, and deregister on exit.
  324.  
  325. application will generally find its help file and register on entry, display
  326.  
  327. functions, HoWRegister, HoWDisplay, and HoWDeregister.  Your
  328.  
  329. functions, HoWFindHelpFile and HoWOpen, and three client engine
  330.  
  331. The interface, described in the next subsection, consists of two utility
  332.  
  333. 
  334.  
  335. xThe Client Engine
  336.  
  337. 
  338.  
  339. 
  340.  
  341. 
  342.  
  343. 
  344.  
  345. server, with the help of the HoWLib client interface library.
  346.  
  347. This section explains how a client conducts its relations with the help
  348.  
  349. 
  350.  
  351. 
  352.  
  353. √•Client-Server Relations
  354.  
  355. @
  356.  
  357. @
  358.  
  359. 
  360.  
  361. 
  362.  
  363.